package com.AEWMS.Servlet;

import com.AEWMS.Service.CourseScoreService;
import com.alibaba.fastjson.JSON;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ths
 * @create 2021/3/31 23:22
 */
@WebServlet(name = "ScoreChangeServlet", urlPatterns = "/ScoreChangeServlet")
public class ScoreChangeServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String studentNumber = request.getParameter("p1");
        String courseID = request.getParameter("p2");
        CourseScoreService css = new CourseScoreService();
        System.out.println(css.findCourseScoreById(studentNumber,courseID));
        response.getWriter().println(JSON.toJSONString(css.findCourseScoreById(studentNumber,courseID)));
    }
}
